package com.biz.primus.ms.evaluation.dao.po;

import com.biz.primus.ms.base.jpa.converter.ListStringConverter;
import com.biz.primus.ms.base.jpa.po.BaseEntity;
import lombok.Data;

import javax.persistence.*;
import java.util.List;

/**
 * 商品评价 {订单编号、商品编号、商品评分、评价内容、图片}
 *
 * @author Tiger Feng
 * @date 2017年11月06日
 */
@Data
@Entity
@Table(name = "ord_evaluation_product",indexes = {
        @Index(name = "idx_ord_evaluation_product_order_code",columnList = "orderCode"),
        @Index(name = "idx_ord_evaluation_product_product_code",columnList = "productCode"),
        @Index(name = "idx_ord_evaluation_product_depot_ode",columnList = "depotCode")
})
public class ProductEvaluation extends BaseEntity {
    /**
     * 订单评价
     */
    @ManyToOne
    private OrderEvaluation orderEvaluation;
    /**
     * 订单编号
     */
    @Column(length = 64, unique = true)
    private String orderCode;
    /**
     * 商品编号
     */
    @Column(length = 50, nullable = false,unique = true)
    private String productCode;
    /**
     * 门店编号
     */
    @Column(length = 50, nullable = false, unique = true)
    private String depotCode;
    /**
     * 评分
     */
    @Column(nullable = false)
    private Integer score;
    /**
     * 评价内容
     */
    @Column(columnDefinition = "TEXT")
    private String content;
    /**
     * 评价图片
     */
    @Column(columnDefinition = "TEXT")
    @Convert(converter = ListStringConverter.class)
    private List<String> images;
}
